//
//  TableView.swift
//  MoyoungCommon
//
//  Created by 李然 on 2022/7/19.
//

import UIKit

open class TableView: UITableView {

    public override init(frame: CGRect, style: UITableView.Style) {
        super.init(frame: frame, style: style)
        makeUI()
    }

    required public init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        makeUI()
    }

    open func makeUI() {
        rowHeight = UITableView.automaticDimension
        estimatedRowHeight = 50
        sectionHeaderHeight = 0
        backgroundColor = .clear
        keyboardDismissMode = .onDrag
        separatorColor = .clear
        separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
        let footer = View(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 1))
        footer.backgroundColor = self.backgroundColor
        tableFooterView = footer
        let header = View(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 1))
        header.backgroundColor = self.backgroundColor
        tableHeaderView = header
    }
}
